p.prior = c(0.9,0.1)
p.witness = 0.8

witness = c(1,2,2,2)


# step 0
p.poste = p.prior
print(paste('P(X=A | evidence)', 'P(X=B | evidence)'))
print(p.poste)

# step i > 0
for (i in 1:length(witness)) {
	if (witness[i] == 1) 
		p.poste = p.poste * c(p.witness,1-p.witness)
	else 
		p.poste = p.poste * c(1-p.witness,p.witness)
	p.poste = p.poste / sum(p.poste)

	print(p.poste)
}



